<template>
  <div id="CompletionAcceptance" :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }">
    <div v-if="show">
      <div class="top">
        <img style="width: 80%; margin: 0 auto"
          src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/YPC/13.png" />
        <p>
          <span style="width: 27%; display: inline-block; text-align: center">项目基本信息</span>
          <span style="width: 45%; display: inline-block; text-align: center">签订合同</span>
          <span style="width: 25%; display: inline-block; text-align: center">申请验收</span>
        </p>
      </div>
      <div v-if="contentShow" class="content">
        <p class="title" :class="{
          titleSmallFontSize: showEdition,
          titleMediumFontSize: !showEdition,
        }">
          <span class="line"></span>
          四到场
        </p>
        <ul>
          <li v-for="(item, index) in contentData" :key="index" :style="{
            background:
              'url(https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/ZLJ/SGRZ/' + item.bg + '.png)',
            paddingLeft: '15px',
          }" @click="showPopup(item)">
            <p style="margin-bottom: 8px">
              <span>{{ item.proc_name }}</span>
              <i v-if="item.isRed" style="display: block;background: #f00;border-radius: 50%;width: 0.4em;height: 0.4em;top: -30px;right: -5.2em;position: relative;"></i>
            </p>
          </li>
        </ul>
        <p class="title" :class="{
          titleSmallFontSize: showEdition,
          titleMediumFontSize: !showEdition,
        }" style="clear: both">
          <span class="line"></span>
          节点检查
        </p>
        <ul>
          <li v-for="(item, index) in contentData1" :key="index" :style="{
            background:
              'url(https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/ZLJ/SGRZ/' + item.bg + '.png)',
            paddingLeft: '20px',
          }" @click="contentData1Click(item)">
            <p style="margin-bottom: 8px">
              <span style="width: calc(100% - 70px); display: inline-block">
                {{ item.proc_name }}
              </span>
            </p>
          </li>
        </ul>
        <p :class="{
          titleSmallFontSize: showEdition,
          titleMediumFontSize: !showEdition,
        }" class="title" style="clear: both">
          <span class="line"></span>
          施工日志
        </p>
        <div>

        </div>
        <div style="padding: 10px; text-align: center">
          <div @click="addSGRZ()" class="addSGRZ">
            <span style="width: 65%; display: inline-block">添加施工日志</span>
          </div>
          <!--<van-button @click="show=false" icon="plus" round type="primary"></van-button>-->
        </div>
        <p class="title" :class="{
          titleSmallFontSize: showEdition,
          titleMediumFontSize: !showEdition,
        }" style="clear: both">
          <span class="line"></span>
          更换工匠
        </p>
        <ul>
          <li @click="handleOk1" v-for="(item, index) in contentData2" :key="index" :style="{
            background:
              'url(https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/ZLJ/SGRZ/' + item.bg + '.png)',
            paddingLeft: '15px',
          }">
            <p style="margin-bottom: 8px">
              <span>{{ item.proc_name }}</span>
              <i v-if="item.isRed" style="
                                      display: block;
                                      background: #f00;
                                      border-radius: 50%;
                                      width: 0.4em;
                                      height: 0.4em;
                                      top: -30px;
                                      right: -5.2em;
                                      position: relative;
                                    "></i>
            </p>
          </li>
        </ul>
      </div>
      <div v-if="!contentShow">
        <p class="title" :class="{
          titleSmallFontSize: showEdition,
          titleMediumFontSize: !showEdition,
        }" style="clear: both">
          <span class="line"></span>
          脚手架验收
        </p>
        <div style="padding: 10px">
          <div class="btn" @click="openProcess('kjs')">扣件式钢管脚手架检查验收表</div>
          <div class="btn1" @click="openProcess('zjs')">竹脚手架检查验收表</div>
        </div>
        <p class="title" :class="{
          titleSmallFontSize: showEdition,
          titleMediumFontSize: !showEdition,
        }" style="clear: both">
          <span class="line"></span>
          墙体架构验收
        </p>
        <div style="padding: 10px">
          <div class="btn" @click="openProcess('ztq')">砖砌体架构质量检查和验收表</div>
          <div class="btn1" @click="openProcess('xjh')">现浇混凝土结构质量和验收表</div>
        </div>
      </div>
    </div>
    <div v-else>
      <div style="text-align: center;">
        <div @click="handleButtons('施工备案证申请')" style="margin: 10px 0;"><van-button style="width: 90vw;"
            type="info">施工备案证申请</van-button></div>
        <div @click="handleButtons('施工备案证变更')" style="margin: 10px 0;"><van-button style="width: 90vw;"
            type="info">施工备案证变更</van-button></div>
        <div @click="handleButtons('施工备案证中止')" style="margin: 10px 0;"><van-button style="width: 90vw;"
            type="info">施工备案证中止</van-button></div>
        <div @click="handleButtons('施工备案证恢复')" style="margin: 10px 0;"><van-button style="width: 90vw;"
            type="info">施工备案证恢复</van-button></div>
        <div @click="handleButtons('施工备案证延期')" style="margin: 10px 0;"><van-button style="width: 90vw;"
            type="info">施工备案证延期</van-button></div>
        <div @click="handleButtons('返回')" style="margin: 10px 0;"><van-button style="width: 90vw;"
            type="info">返回</van-button></div>
      </div>
    </div>
    <van-popup v-model="shoulm1">
      <div class="con_box">
        <h3>{{ text1.title }}</h3>
        <p>{{ text1.message }}</p>
        <div class="btnv">
          <span @click="handleClose1()" v-if="text1.btn.cancelText">
            {{ text1.btn.cancelText }}
          </span>
          <span @click="handleOk1(SaveData)" v-if="text1.btn.okText">
            {{ text1.btn.okText }}
          </span>
        </div>
      </div>
    </van-popup>
    <van-popup v-model="shoulm">
      <div class="con_box">
        <h3>{{ text.title }}</h3>
        <p>{{ text.message }}</p>
        <div class="btnv">
          <span @click="handleClose()" v-if="text.btn.cancelText">
            {{ text.btn.cancelText }}
          </span>
          <span @click="handleOk(SaveData)" v-if="text.btn.okText">
            {{ text.btn.okText }}
          </span>
        </div>
      </div>
    </van-popup>
  </div>
</template>
<script>
import {
  LoadGridData,
  FileServerUpload,
  InsertDataView,
  dataServerOpenDataView,
  CreateProcessAndSendTask,
  GetFileData,
  DelectFile,
  QuerySignCallback,
} from '../../utils/api'
import { GJDBFunction2 } from '@/utils/queryData'
export default {
  data() {
    return {
      contentShow: true,
      //施工备案
      RUNTYPE:'',
      PROC_STATUS:"",
      showEdition: false,
      show1: false,
      dataValue: '',
      IF_ZZEND: false,
      listData: [
        {
          name: '放样',
          children: [
            {
              name: '四边长度',
              groupGuid: 'b9bcaba3-82f1-4c9b-8585-9ec7d0d7aed6',
              fileList: [],
            },
          ],
        },
        {
          name: '地基钢筋',
          children: [
            {
              name: '规格寄照片',
              groupGuid: 'e1949021-c239-4473-95d0-35b260103e2f',
              fileList: [],
            },
          ],
        },
        {
          name: '基础',
          children: [
            {
              name: '轴线尺寸',
              groupGuid: '8c853bca-2a3d-4a73-b7b6-34ea098b2ce0',
              fileList: [],
            },
            {
              name: '混凝土强度',
              groupGuid: '816f51d2-1f28-4fe3-8679-75b21503fbed',
              fileList: [],
            },
            {
              name: '防水',
              groupGuid: '6db48286-81df-49e6-89d7-ee48b915931a',
              fileList: [],
            },
            {
              name: '管线预埋',
              groupGuid: '509b147c-c6dc-43f0-8477-3a6bee96874a',
              fileList: [],
            },
            {
              name: '结构预埋件',
              groupGuid: '7c2d50e1-3499-4173-a6ee-782b75949d74',
              fileList: [],
            },
          ],
        },
        {
          name: '一层',
          children: [
            {
              name: '层高',
              groupGuid: '3e319216-491b-42e7-9b49-502eec61a6c8',
              fileList: [],
            },
            {
              name: '楼面尺寸',
              groupGuid: '11c1ce8f-601b-4e83-aec8-309de8b88ce7',
              fileList: [],
            },
            {
              name: '梁柱及板钢筋照片',
              groupGuid: 'b717d43e-cc51-4647-a096-f017dd236062',
              fileList: [],
            },
          ],
        },
        {
          name: '二层',
          children: [
            {
              name: '层高',
              groupGuid: '1fadb4fd-87ee-456c-a19c-04d7f2526615',
              fileList: [],
            },
            {
              name: '楼面尺寸',
              groupGuid: '37afcffe-26a5-40a3-ac6d-0a36ef16fde9',
              fileList: [],
            },
            {
              name: '梁柱及板钢筋照片',
              groupGuid: '691c6c0f-8baa-4425-8211-f2f9bee429dc',
              fileList: [],
            },
          ],
        },
        {
          name: '三层',
          children: [
            {
              name: '层高',
              groupGuid: '71081664-56ba-4676-b14c-b569b181153f',
              fileList: [],
            },
            {
              name: '楼面尺寸',
              groupGuid: 'c5b125ad-21a9-4768-b60f-e8038d89e3a9',
              fileList: [],
            },
            {
              name: '梁柱及板钢筋照片',
              groupGuid: 'c5b125ad-21a9-4768-b60f-e8038d89e3a9',
              fileList: [],
            },
          ],
        },
        {
          name: '结顶',
          children: [
            {
              name: '顶高',
              groupGuid: '8486d5b6-4b96-4b9b-96b3-8a3c80fae57c',
              fileList: [],
            },
            {
              name: '檐口高',
              groupGuid: '2bb5cf21-d68f-47c4-8e1f-2fb3218f9d09',
              fileList: [],
            },
            {
              name: '滴水尺寸',
              groupGuid: '5d79e0f3-3acf-4ed9-8dc3-14dbc96d955b',
              fileList: [],
            },
            {
              name: '房屋坡度',
              groupGuid: '2ac8070b-787d-4fe5-a788-3049e59aaebc',
              fileList: [],
            },
            {
              name: '避雷',
              groupGuid: 'fe9109db-3b5e-4cd8-abcd-be0cdb937270',
              fileList: [],
            },
          ],
        },
        {
          name: '外立面',
          children: [
            {
              name: '四周照片',
              groupGuid: '8978af55-f704-4d68-b660-3de9817dc42c',
              fileList: [],
            },
          ],
        },
        {
          name: '隐蔽工程',
          children: [
            {
              name: '水电',
              groupGuid: '91047b97-80ac-47c7-a2d5-bd708d1f1ec0',
              fileList: [],
            },
            {
              name: '防水',
              groupGuid: 'd525a87f-dd62-4c1d-93c3-b376cac502b9',
              fileList: [],
            },
          ],
        },
      ],
      show: true,
      contentData: [
        {
          proc_name: '定位放样',
          bg: '1',
          isRed: false,
        },
        {
          proc_name: '基槽验线',
          bg: '2',
          isRed: false,
        },
        {
          proc_name: '一层立模',
          bg: '3',
          isRed: false,
        },
        {
          proc_name: '竣工验收',
          bg: '4',
          isRed: false,
        },
      ],
      contentData2: [
        {
          proc_name: '更换工匠',
          bg: '1',
          isRed: false,
        }
      ],
      contentData3: [
        {
          proc_name: '施工备案',
          bg: '1',
          isRed: false,
        }
      ],
      contentData1: [
        // {
        //   proc_name: "地基和基础施工质量验收",
        //   bg: "5",
        // },
        // {
        //   proc_name: "一层",
        //   bg: "6",
        // },
        {
          proc_name: '二层',
          bg: '7',
        },
        {
          proc_name: '三层',
          bg: '8',
        },
        // {
        //   proc_name: "结构工程施工质量验收",
        //   bg: "9",
        // },
      ],
      fileList: [],
      rowGuid: '',
      isSave: false,
      value: '扣件式钢管脚手架验收',
      columns: ['扣件式钢管脚手架验收', '竹脚手架检查验收'],
      showPicker: false,
      SaveData: '',
      shoulm: false,
      isRed: false,
      text: {
        title: '提示',
        message: '请确认是否发起定位放样申请?',
        btn: {
          okText: '确定',
          cancelText: '取消',
        },
      },
      text1: {
        title: '提示',
        message: '请确认是否需要更换工匠?',
        btn: {
          okText: '确定',
          cancelText: '取消',
        },
      },
      shoulm1: false,
    }
  },
  methods: {
    contentData1Click(item) {
      switch (item.proc_name) {
        case '一层':
          this.$router.push({
            path: '/formworkErection',
            query: {
              data: JSON.stringify(this.tableData),
              data1: JSON.stringify(item),
              number: this.tableData.BUILDSTOREY,
            },
          })
          break
        case '二层':
          this.$router.push({
            path: '/formworkErection',
            query: {
              data: JSON.stringify(this.tableData),
              data1: JSON.stringify(item),
              number: this.tableData.BUILDSTOREY,
            },
          })
          break
        case '三层':
          this.$router.push({
            path: '/formworkErection',
            query: {
              data: JSON.stringify(this.tableData),
              data1: JSON.stringify(item),
              number: this.tableData.BUILDSTOREY,
            },
          })
          break
        case '地基和基础施工质量验收':
          this.$router.push({
            path: '/DJHJCSG',
            query: {
              data: JSON.stringify(this.tableData),
              data1: JSON.stringify(item),
            },
          })
          break
        case '结构工程施工质量验收':
          this.$router.push({
            path: '/JGGCSGZLYSB',
            query: {
              data: JSON.stringify(this.tableData),
              data1: JSON.stringify(item),
            },
          })
          break
      }
    },
    handleButtons(data) {
      /**
            '2' -- 施工备案证变更
            '3' -- 施工备案证中止
            '4' -- 施工备案证恢复
            '5' -- 施工备案证延期
         */
      //注意：中止中才能恢复
      //将当前行的数据保存
      window.sessionStorage.setItem('fileData', JSON.stringify(this.tableData))
      if (data == '返回') {
        this.show = true
      } else if (data == '施工备案证变更') {
        window.sessionStorage.setItem('RUNTYPE', "2")
        this.$router.push({
          path: "/biangeng"
        })
      } else if (data == '施工备案证中止') {
        window.sessionStorage.setItem('RUNTYPE', "3")
        this.$router.push({
          path: "/biangeng"
        })
      } else if (data == '施工备案证恢复') {
        //必须处在中止结束环节才可恢复
        if (this.IF_ZZEND) {
          window.sessionStorage.setItem('RUNTYPE', "4")
          this.$router.push({
            path: "/biangeng"
          })
        } else {
          this.$toast.fail('暂不支持发起施工备案证恢')
        }
      } else if (data == '施工备案证延期') {
        window.sessionStorage.setItem('RUNTYPE', "5")
        this.$router.push({
          path: "/biangeng"
        })
      } else if (data == "施工备案证申请"){
        window.sessionStorage.setItem('fileData', JSON.stringify(this.tableData))
        this.$router.push({
          path: "/fileData"
        })
      }
    },
    //弹出框
    showPopup(data) {
      debugger
      //先要判断施工备案是否审核完毕
      // if(!(this.RUNTYPE  == '1' && this.PROC_STATUS == '2')){
      //   this.$toast.fail('请先完成施工备案证申请')
      //   return false
      // }
      this.dataValue = data.proc_name
      this.SaveData = data
      //工匠暂不支持定位放样以及三个环节的提交
      if (data.proc_name == '定位放样' && window.localStorage.getItem('isGJM') == 'false') {
        this.$toast.fail('工匠暂不支持定位放样')
      } else {
        // this.$store.state.HJZT === 4 &&
        if ((this.$store.state.HJZT === 4  ||this.$store.state.HJZT==26) && data.proc_name == '定位放样') {
          //逻辑要重写了  新增施工备案
          debugger
          this.show = true
          //OPTYPE == 59 是工匠  60是建筑企业的件
          data?.OPTYPE == '59' ? this.shoulm1 = true : this.shoulm = true
          //   //调用存储过程
          this.getdata4(data)
        } else if (this.$store.state.HJZT === 6 && data.proc_name == '基槽验线') {
          this.handleButton()
        } else if (this.$store.state.HJZT === 8 && data.proc_name == '一层立模') {
          this.handleButton()
        } else if (this.$store.state.HJZT === 7 && data.proc_name == '竣工验收') {
          this.handleButton()
        } else {
          this.$toast.fail('暂未到此环节！')
        }
      }
    },
    async getdata4(data) {
      let paerssend = {
        procName: 'IN_farmersrole',
        dtParams: JSON.stringify([{ I_USERID: window.localStorage.getItem('DanDianPhone') }]),
        token: window.localStorage.getItem('token'),
      }
      let paramsendMEssage = {
        accessCode: '69db6bece3a7480592e2ec753d1e335e',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: paerssend,
      }
      const reqwmsg = await QuerySignCallback(paramsendMEssage)
    },
    handleButton(data) {
      if (data == '取消') {
        this.show1 = false
      } else {
        switch (this.dataValue) {
          case '基槽验线':
            this.$router.push({
              path: '/DJHJCSG',
              query: {
                data: JSON.stringify(this.tableData),
                data1: JSON.stringify(this.SaveData),
              },
            })
            break
          case '竣工验收':
            this.$router.push({
              path: '/JGGCSGZLYSB',
              query: {
                data: JSON.stringify(this.tableData),
                data1: JSON.stringify(this.SaveData),
                data2: '竣工验收',
              },
            })
            break
          case '定位放样':
            this.handleClick(this.SaveData)
            this.show1 = false
            break
          case '一层立模':
            this.$router.push({
              path: '/formworkErection',
              query: {
                data: JSON.stringify(this.tableData),
                data1: JSON.stringify(this.SaveData),
                number: this.tableData.BUILDSTOREY,
                data2: '一层立模',
              },
            })
            break
        }
      }
    },
    handleClick: async function (data) {
      //调用当前环节的接口
      if (this.$store.state.isGJ) {
        if (
          ((this.$store.state.HJZT === 4 || this.$store.state.HJZT === 26)  && data.proc_name != '定位放样') ||
          (this.$store.state.HJZT === 6 && data.proc_name != '基槽验线') ||
          (this.$store.state.HJZT === 8 && data.proc_name != '一层立模') ||
          (this.$store.state.HJZT === 7 && data.proc_name != '竣工验收')
        ) {
          this.$toast.fail('未到此环节!')
        }
        if ((this.$store.state.HJZT === 4  ||this.$store.state.HJZT === 26) && data.proc_name == '定位放样') {
          setTimeout(() => {
            this.$router.push({
              path: '/TreeSelectZL',
              query: {
                data: { TASK_ID: this.tableData, isdwfy: 1 },
                data2: '定位放样',
              },
            })
          }, 500)
        } else if (this.$store.state.HJZT === 6 && data.proc_name == '基槽验线') {
          setTimeout(() => {
            this.$router.push({
              path: '/TreeSelectZL',
              query: {
                data: { TASK_ID: this.tableData, isyclm: 1 },
                data2: '基槽验线',
              },
            })
          }, 500)
        } else if (this.$store.state.HJZT === 8 && data.proc_name == '一层立模') {
          setTimeout(() => {
            this.$router.push({
              path: '/TreeSelectZL',
              query: {
                data: { TASK_ID: this.tableData, isyclm: 1 },
                data2: '一层立模',
              },
            })
          }, 500)
        } else if (this.$store.state.HJZT === 7 && data.proc_name == '竣工验收') {
          setTimeout(() => {
            this.$router.push({
              path: '/TreeSelectZL',
              query: {
                data: { TASK_ID: this.tableData, isjgys: 1 },
                data2: '竣工验收',
              },
            })
          }, 500)
        }
      } else {
        if (
          ((this.$store.state.HJZT === 4 || this.$store.state.HJZT === 26) && data.proc_name != '定位放样') ||
          (this.$store.state.HJZT === 6 && data.proc_name != '基槽验线') ||
          (this.$store.state.HJZT === 8 && data.proc_name != '一层立模') ||
          (this.$store.state.HJZT === 7 && data.proc_name != '竣工验收')
        ) {
          this.$toast.fail('未到此环节!')
        }
        if ((this.$store.state.HJZT === 4 || this.$store.state.HJZT === 26) && data.proc_name == '定位放样') {
          window.localStorage.setItem('isNHCW', 1)
          setTimeout(() => {
            this.$router.push({
              path: '/TreeSelect',
              query: {
                data: this.tableData,
                isdwfy: 1,
                isdwfyNew: 1,
              },
            })
          }, 500)
        } else if (this.$store.state.HJZT === 6 && data.proc_name == '基槽验线') {
          window.localStorage.setItem('isNHCW', 1)
          setTimeout(() => {
            this.$router.push({
              path: '/TreeSelect',
              query: {
                data: this.tableData,
                isjcyx: 1,
                isjcyxNew: 1,
              },
            })
          }, 500)
        } else if (this.$store.state.HJZT === 8 && data.proc_name == '一层立模') {
          window.localStorage.setItem('isNHCW', 1)
          setTimeout(() => {
            this.$router.push({
              path: '/TreeSelect',
              query: {
                data: this.tableData,
                isyclm: 1,
                isyclmNew: 1,
              },
            })
          }, 500)
        } else if (this.$store.state.HJZT === 7 && data.proc_name == '竣工验收') {
          window.localStorage.setItem('isNHCW', 1)
          setTimeout(() => {
            this.$router.push({
              path: '/TreeSelect',
              query: {
                data: this.tableData,
                isjgys: 1,
                isjgysNew: 1,
              },
            })
          }, 500)
        }
      }
    },
    handleClose() {
      this.shoulm = false
    },
    handleOk(data) {
      this.handleButton()
    },
    handleClose1() {
      this.shoulm1 = false
      this.shoulm = true
    },
    handleOk1(data) {
      // this.handleButton();
      //更换工匠 标识1
      this.$confirm({
        title: '提示',
        message: '请确认是否需要更换工匠？',
        btn: {
          okText: '确定',
          cancelText: '取消'
        }
      })
        .then(() => {
          // do something
          window.sessionStorage.setItem('ChangeGJ', true)
          //跳入更换工匠页面
          this.$router.push({
            path: 'craftsmanServices',
            query: {
              id1: '更换工匠',
              dataValue: JSON.stringify(this.tableData),
            },
          })
        })
        .catch(() => {
          console.log('no')
        })
    },
    addSGRZ: async function () {
      this.show = false
      this.$router.push({
        path: 'ConstructionLog',
        query: {
          data: JSON.stringify(this.tableData),
        },
      })
    },
    newGuid(format) {
      //表示全局唯一标识符 (GUID)。
      function Guid(g) {
        var arr = new Array() //存放32位数值的数组
        if (typeof g == 'string') {
          //如果构造函数的参数为字符串
          InitByString(arr, g)
        } else {
          InitByOther(arr)
        }
        //返回 Guid 类的此实例值的 String 表示形式。
        this.ToString = function (format) {
          if (typeof format == 'string') {
            if (format == 'N' || format == 'D' || format == 'B' || format == 'P') {
              return ToStringWithFormat(arr, format)
            } else {
              return ToStringWithFormat(arr, 'D')
            }
          } else {
            return ToStringWithFormat(arr, 'D')
          }
        }

        //由字符串加载
        function InitByString(arr, g) {
          g = g.replace(/\{|\(|\)|\}|-/g, '')
          g = g.toLowerCase()
          if (g.length != 32 || g.search(/[^0-9,a-f]/i) != -1) {
            InitByOther(arr)
          } else {
            for (var i = 0; i < g.length; i++) {
              arr.push(g[i])
            }
          }
        }

        //由其他类型加载
        function InitByOther(arr) {
          // var i = 32;
          // while (i--) {
          //     arr.push("0");
          // }

          var i = 32
          while (i--) {
            arr.push(Math.floor(Math.random() * 16.0).toString(16))
          }
        }

        /*
            根据所提供的格式说明符，返回此 Guid 实例值的 String 表示形式。
            N  32 位： xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            D  由连字符分隔的 32 位数字 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
            B  括在大括号中、由连字符分隔的 32 位数字：{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
            P  括在圆括号中、由连字符分隔的 32 位数字：(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
            */

        //增加一个标识能区分开这个guid是不是由前端生成的
        function ToStringWithFormat(arr, format) {
          switch (format) {
            case 'N':
              return arr.toString().replace(/,/g, '')
            case 'D':
              var str =
                arr.slice(0, 8) + '-1203' + '-' + arr.slice(12, 16) + '-' + arr.slice(16, 20) + '-' + arr.slice(20, 32)
              str = str.replace(/,/g, '')
              return str
            case 'B':
              var str = ToStringWithFormat(arr, 'D')
              str = '{' + str + '}'
              return str
            case 'P':
              var str = ToStringWithFormat(arr, 'D')
              str = '(' + str + ')'
              return str
            default:
              return new Guid()
          }
        }

        return this.ToString()
      }

      var g = new Guid()
      return g.ToString(format)
    },
    //获取施工备案类型
    /**
     * 	'1' -- 施工备案证申请
        '2' -- 施工备案证变更
        '3' -- 施工备案证中止
        '4' -- 施工备案证恢复
        '5' -- 施工备案证延期
     */
    async getData1() {
      const res = await GJDBFunction2("get_SGXK_TYPE", [{ "task_recipient": this.rowData.ROW_GUID }])
      //将返回值存入localhost 当前环节为施工备案证中止环节 并且已经结束 才能发起施工备案证恢复
      this.RUNTYPE = res[0].RUNTYPE
      this.PROC_STATUS = res[1].PROC_STATUS
      if (res[0].RUNTYPE == '3' && res[1].PROC_STATUS == '2') {
        this.IF_ZZEND = true
      } else {
        this.IF_ZZEND = false
      }
      //判断当前件是否为施工备案证环节并且为已结束
      window.sessionStorage.setItem('RUNTYPE', res[0].RUNTYPE)
    }
  },
  created() {
    this.getData1()
  },
  mounted() {
    this.showEdition = this.$store.state.Edition
    this.rowGuid = this.newGuid()
    this.tableData = JSON.parse(this.$route.query.data)
    if (this.$store.state.HJZT === 4 || this.$store.state.HJZT === 26 ) {
      this.contentData[0].isRed = true
    } else if (this.$store.state.HJZT === 6) {
      this.contentData[1].isRed = true
    } else if (this.$store.state.HJZT === 8) {
      this.contentData[2].isRed = true
    } else if (this.$store.state.HJZT === 7) {
      this.contentData[3].isRed = true
    }
  },
  //      http://172.16.218.58:28800/dataserver/api/LoadGridData
}
</script>
<style lang="scss">
/*ROW_GUID*/
#CompletionAcceptance {
  height: 100vh;
  overflow: auto;
  background: #f6f6f6;

  .buttonVan {
    width: 100%;
    padding-top: 20px;
    position: relative;

    .buttonVan1 {
      position: absolute;
      left: 15%;
    }

    .buttonVan2 {
      position: absolute;
      left: 37%;
    }
  }

  .line {
    width: 6px;
    height: 26px;
    background: #3f8ffc;
    display: inline-block;
    margin-right: 10px;
  }

  .top {
    height: 50px;
    background: #ffffff;
    margin-bottom: 20px;
    // padding-top: 25px;
    text-align: center;

    .origin {
      width: 22px;
      height: 22px;
      background: #007aff;
      border-radius: 50%;
      display: inline-block;
    }

    .line {
      width: 20vw;
      /*height: 1px;*/
      border: 1px dashed #007aff;
      display: inline-block;
    }
  }

  .addSGRZ {
    width: 49%;
    height: 70px;
    background: url('https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/ZLJ/SGRZ/10.png');
    background-size: 100% 100%;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 40px;
  }

  .title {
    width: 100%;
    height: 50px;
    /*background: #007aff;*/
    line-height: 50px;
    /*text-align: center;*/
    font-size: 18px;
    position: relative;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #9b9b9b;
  }

  .content {
    background: #ffffff;
    height: calc(100vh - 74px);
    overflow: auto;
    padding: 10px;

    ul li {
      width: calc(49% - 10px);
      border-radius: 20px;
      margin-top: 10px;
      margin-left: 10px;
      height: 70px;
      background-size: 100% 100% !important;
      float: left;
      text-align: center;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }

  .btn {
    height: 80px;
    background: url('../../../static/imgs/ZLJ/52.png');
    background-size: 100% 100%;
    display: flex;
    align-items: center;
    padding-left: 70px;
    margin-bottom: 10px;
  }

  .btn1 {
    height: 80px;
    background: url('../../../static/imgs/ZLJ/53.png');
    background-size: 100% 100%;
    display: flex;
    align-items: center;
    padding-left: 70px;
  }

  .van-popup {
    border-radius: 10px;

    .con_box {
      width: 270px;
      line-height: 1;
      text-align: center;
      color: #4d5c82;
      padding: 15px;
      box-sizing: border-box;

      >h3 {
        font-size: 18px;
        margin-top: 10px;
        margin-bottom: 20px;
      }

      >p {
        font-size: 14px;
        margin-bottom: 30px;
      }

      .btnv {
        display: flex;
        justify-content: space-between;

        >span {
          display: block;
          width: 114px;
          background-color: #e0e5f5;
          text-align: center;
          line-height: 44px;
          font-size: 14px;
        }

        >span:last-of-type {
          background-color: #1288fe;
          color: #ffffff;
        }
      }
    }
  }
}
</style>
<style>
.van-uploader__wrapper {
  -webkit-flex-wrap: nowrap !important;
  flex-wrap: nowrap !important;
}
</style>
